fix(pgpm): suppress stale update notification after pgpm update#749
Merged
pyramation merged 3 commits intomainfrom Feb 27, 2026
Merged
fix(pgpm): suppress stale update notification after pgpm update#749pyramation merged 3 commits intomainfrom
pyramation merged 3 commits intomainfrom
Conversation
After pgpm update installs a new version, the currently running binary still reports the old version via getPackageJson(__dirname). Previously, clearUpdateCache merely deleted the cache file, causing the next command to fetch the latest from npm and compare against the stale pkgVersion, producing a false-positive 'Update available' message. Instead, write a cache entry with the current binary's version as latestVersion so the next checkForUpdates call sees no update needed. The cache expires after 24h, at which point a fresh check runs against the (by then correct) new binary version.
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
3 tasks
Replace inline cache-writing logic with the new suppressUpdateCheck export from @inquirerer/utils. This keeps the cache format knowledge in one place (the utils package) rather than duplicating it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(pgpm): suppress stale update notification after pgpm update
Summary
After running
pgpm update, subsequent commands incorrectly show "Update available: X -> Y" even though the update just completed successfully.Root cause:
pgpm updateruns under the old binary. Afternpm install -g pgpmcompletes, the old binary callsclearUpdateCache('pgpm')which deletes the cache file. The next pgpm command (still resolving to the old binary path, e.g. due tomisereshim timing) finds no cache, fetches the latest version from npm, compares it against the stalepkgVersionfromgetPackageJson(__dirname), and shows a false-positive update notification.Fix: Replace
clearUpdateCache('pgpm')with the newsuppressUpdateCheck('pgpm', pkgJson.version)from@inquirerer/utils@3.3.0. This writes a cache entry withlatestVersionset to the current binary's version, so the nextcheckForUpdatescall seeslatestVersion === pkgVersion→hasUpdate: false. The cache naturally expires after 24h, at which point a fresh check runs against the (by then correct) new binary.Companion PR
The
suppressUpdateCheckfunction was added in dev-utils#65, which has been merged and published as@inquirerer/utils@3.3.0.Changes
pgpm/cli/src/commands/update.ts: swapclearUpdateCache→suppressUpdateCheckimport and callpgpm/cli/package.json: bump@inquirerer/utilsfrom^3.2.3to^3.3.0pnpm-lock.yaml: resolve@inquirerer/utils@3.3.0(plus pnpm formatting changes)Review & Testing Checklist for Human
pgpm update, then immediately runpgpm package(or any other command) — the "Update available" message should no longer appear.@inquirerer/utilsresolving to3.3.0(and its new transitive depappstash@0.5.0). Confirm no unexpected dependency changes snuck in.suppressUpdateCheckfalls back toclearUpdateCache, which re-exposes the original false-positive. Verify this fallback is acceptable.Notes